public class UserAccount{

	private String email;
	private String name;
	private String pi;
	private double accumulatedOverdraftFee;
	
	
	
	public UserAccount(String name, String personalIdentifier, String email){
		if(name==null || email==null || personalIdentifier==null){
			throw new NullPointerException("NullPointerException!");
		}
		this.name=name;
		this.email=email;
		pi=personalIdentifier;
		this.accumulatedOverdraftFee = 0.0;
	}
	
	public UserAccount(UserAccount ua){
		if(ua==null){
			throw new NullPointerException("NullPointerException!");
		}
		this.email = ua.email;
		this.name = ua.name;
		this.pi = ua.pi;
		this.accumulatedOverdraftFee = ua.accumulatedOverdraftFee;
	}
	
	public String getName(){
		return name;
	}
	
	
	public String getEMail(){
		return email;
	}

	
	public void setEMail(String email){
		if(email==null){
			throw new NullPointerException("NullPointerException!");
		}
		this.email=email;
	}
	
	public void setName(String name){
		if(name==null){
			throw new NullPointerException("NullPointerException!");
		}
		this.name=name;
	}
	
	public String getIdentifier(){
		return pi;
	}
	
	public void addToAccumulatedOverdraftFee(double amount){
		if(amount>0.0){
		accumulatedOverdraftFee = accumulatedOverdraftFee+amount;
		}
		else {
			throw new IllegalArgumentException();
		}
	}
	
	public void subtractFromAccumulatedOverdraftFee(double amount){
		if(amount>0.0){
		accumulatedOverdraftFee = accumulatedOverdraftFee-amount;
		}
		else {
			throw new IllegalArgumentException();
		}
	}
	
	public double getAccumulatedOverdraftFee(){
		
		return accumulatedOverdraftFee;
	}
	
	public boolean equals(Object obj){
		if(obj!=null && obj instanceof UserAccount){
			UserAccount user = (UserAccount)obj;
				return this.pi.equals(user.pi);
		}
		return false;
	}
	
	public String toString(){
		return (pi+": "+name+", E-Mail: "+email);
	}
}
